<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="/resource/css/admin/main.css" type="text/css" rel="stylesheet" />
<link href="/resource/css/admin/right.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/resource/js/jquery.js"></script>
<script type="text/javascript" src="/resource/js/base.js"></script>
<script type="text/javascript" src="/resource/js/admin/organization.js"></script>
</head>
<body>
	<div class="position"><span>您的当前位置：</span>组织机构 > 单位管理</div>
	<div class="rightbody f">
		<div class="rightbodycontent">
		    <table class="tools">
		        <tr>
		            <td align="right">
		                <a href="edit" class="linkbtn insert">新建单位</a>
		                <a id="chheckconnection" onclick="checkall();" class="linkbtn search">检测所有单位连接状态</a>
		                <a id="updateall" class="linkbtn recover gray" onclick="alert('全部单位通过连接状态检测才能同步更新到所有单位')">同步更新到所有单位</a>
		            </td>
		        </tr>
		    </table>
		    <table cellspacing="1" cellpadding="4" class="tablelist">
		        <tr>
		            <th>单位名称</th>
		            <th>项目编号</th>
				    <th>公网地址</th>
					<th>内网地址</th>
				    <th id="statename">状态</th>
				    <th>附属状态</th>
				    <th>排序</th>
				    <th width="35%">操作</th>
		        </tr>
		        <#list organizations as organization>
					<tr<#if organization_index % 2 == 1> class="splittr"</#if>>
						<td align="center">${organization.name}</td>
						<td align="center">${organization.project}</td>
						<td align="center">${organization.outterhost}</td>
						<td align="center">${organization.innerhost}</td>
					    <td align="center" class="statetds">
					    	<#if organization.project == orgproject>
						        <img src="/resource/image/admin/main/right/ico/ok.png" />
					        <#else>
					        	<span class="checkstate">等待检测</span>
						        <input type="hidden" name="orgid" value="${organization.id}" />
					        </#if>
					    </td>
					    <td align="center"><span style="color:${organization.attach?string("green\">附加","red\">脱离")}</span></td>
					    <td align="center">${organization.sort}</td>
					    <td align="center">
					    	<#if organization.attach>
						    	<a href="edit?organizationid=${organization.id}" class="linkbtn update noborder">修改</a>
						    	<#if organization.project == orgproject>
						    		<a href="deattach?organizationid=${organization.id}" class="linkbtn deattach noborder managelink">脱离</a>
						    	<#else>
						    		<a class="linkbtn deattach noborder refresh" onclick="checkconnect(${organization_index - 1})">检测</a>
						    		<a class="linkbtn deattach noborder gray managelink" onclick="alert('经过连接状态检测才能使用该功能')">脱离</a>
						    	</#if>
					    	<#else>
					    		<#if organization.project == orgproject>
                                	<a href="attach?organizationid=${organization.id}" class="linkbtn attach noborder managelink">附加</a>
					    		<#else>
                                	<a href="delete?organizationid=${organization.id}" class="linkbtn delete noborder" onclick="return confirm('确定删除吗？')">删除</a>
							    	<a class="linkbtn deattach noborder refresh" onclick="checkconnect(${organization_index - 1})">检测</a>
	                                <a class="linkbtn attach noborder gray managelink" onclick="alert('经过连接状态检测才能使用该功能')">附加</a>
                                </#if>
						    </#if>
							<#if organization.project != orgproject>
								<a class="linkbtn resetpwd noborder gray managelink" onclick="alert('经过连接状态检测才能使用该功能')">重置管理员密码</a>
                                <a class="linkbtn user noborder gray managelink" onclick="alert('经过连接状态检测才能使用该功能')">单点登录</a>
							</#if>
					    </td>
		            </tr>
		        </#list>
		    </table>
		    <br />
			<div style="color:red">凡新建、修改、删除、附加、脱离操作后，请点击同步更新到所有单位</div>
			<input type="hidden" id="orgproject" value="${orgproject}" />
	    </div>
    </div>
</body>
</html>